<template>
      <el-affix :offset="120">
    <el-button type="primary">蛤蛤蛤</el-button>
  </el-affix>
    <el-autocomplete
    v-model="state1"
    :fetch-suggestions="qSerch"
    clearable
    class="inline-input w-50"
    placeholder="请输入内容"
    @select="DnameSelect"/>
    
    
    
</template>
<script setup>
import {ref} from 'vue'
import $axios from '../../utils/axios';

const state1 =ref();
const qSerch =(queryString,cb)=>{
    queryString=queryString?queryString:'*';
    const path="dept/q/dname"+queryString;
    $axios.get(path)
    .then((res)=>{
        const r=res.data.result;

        cb(r.map((v)=>({
            value:v
        })));
    })
    .catch((error)=>{
        console.log(error);
        cb([]);
    })
}


const DnameSelect=(item)=>{
    console.log(item);
}


</script>